package org.uturn.timeshift.web.menus.utils;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

/**
 * Created by przemyslaw.sudak on 2/27/2015.
 */


@XmlRootElement(name = "item")
@XmlType(propOrder = {"name","href","command","icon","update"})
public class ItemMenuModel implements Comparable<ItemMenuModel>{
    private String name;
    private String href;
    private String command;
    private String icon;
    private String update;
    private String submenuTitle;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getHref() {
        return href;
    }

    public void setHref(String href) {
        this.href = href;
    }

    public String getCommand() {
        return command;
    }

    public void setCommand(String command) {
        this.command = command;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public String getUpdate() {
        return update;
    }

    public void setUpdate(String update) {
        this.update = update;
    }

    @XmlAttribute
    public String getSubmenuTitle() {
        return submenuTitle;
    }

    public void setSubmenuTitle(String submenuTitle) {
        this.submenuTitle = submenuTitle;
    }



    @Override
    public String toString(){
        return name + " " + href + "" + submenuTitle + " " + icon + " " + command + " " + update;
    }

    @Override
    public int compareTo(ItemMenuModel o) {
        if(this.submenuTitle != null && o.getSubmenuTitle()!=null)
        return this.submenuTitle.compareTo(o.getSubmenuTitle());

        return  -1;
    }
}
